package com.link.base.base.appduty.service;

import com.link.base.base.appduty.dao.mybatis.mapper.AppSecurityMenuMapper;
import com.link.base.base.appduty.model.AppSecurityMenu;
import com.link.core.basic.dao.mapper.BasicMapper;
import com.link.core.basic.service.BasicServiceException;
import com.link.core.basic.service.BasicServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
/**
 * Copyright  hande Company. All Rights Reserved.
 *
 * @author  unknwon
 * @date:   2018/11/8 13:50
 * @version 1.0
 */

@Service
public class AppSecurityMenuServiceImpl extends BasicServiceImpl<AppSecurityMenu> implements AppSecurityMenuService {

    @Resource
    private AppSecurityMenuMapper appSecurityMenuMapper;

    @Override
    public BasicMapper<AppSecurityMenu> getBasicMapper() {
        return appSecurityMenuMapper;
    }

    /**
     * 查询APP未关联职责菜单的安全性菜单列表
     *
     * @param record
     * @return
     * @throws Exception
     */
    @Override
    public List<AppSecurityMenu> queryUnSelectSubMenuListPage(AppSecurityMenu record) throws Exception {
        return appSecurityMenuMapper.queryUnSelectSubMenuListPage(record);
    }

    @Override
    public List<AppSecurityMenu> querySecurityMenu(Long appRole, Long corpId) {
        if (corpId == null) {
            throw new BasicServiceException("请输入App角色ID");
        }

        return appSecurityMenuMapper.querySecurityMenu(appRole,corpId);
    }
}
